﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using X.Web;

namespace X.WebSite.Admin.Msn
{
    public partial class List : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGridView();
            }
        }

        void BindGridView()
        {
            gvMsnList.DataSource = Bll.Msn.GetAllList();    //TODO:
            gvMsnList.DataBind();
        }

        protected void gvMsnList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int msnId = int.Parse(gvMsnList.DataKeys[e.RowIndex].Value.ToString());

            Bll.Msn.Delete(msnId);

            BindGridView();
        }
    }
}